package com.zzptc.sky.bdsjws.activites;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.zzptc.sky.bdsjws.R;
import com.zzptc.sky.bdsjws.activites.base.BaseActivity;
import com.zzptc.sky.bdsjws.fragments.base.FirstFragmentOneSos;

import butterknife.BindView;

public class OneKeySosActivity extends BaseActivity implements View.OnClickListener {


    @BindView(R.id.fl_sos)
    FrameLayout flSos;
    @BindView(R.id.onekeytoolbar)
    Toolbar toolbarSos;
    @BindView(R.id.img_qusetion)
    ImageView imgQusetion;
    private Object secondFragment;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setSupportActionBar(toolbarSos);
        ActionBar actionBar1 = getSupportActionBar();
        actionBar1.setDefaultDisplayHomeAsUpEnabled(true);
        toolbarSos.setNavigationOnClickListener(this);
    }

    @Override
    public int getContentView() {
        return R.layout.activity_one_key_sos;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        //加载Fragment
        if (secondFragment==null)

        getFragmentManager().beginTransaction().replace(R.id.fl_sos, new FirstFragmentOneSos()).commit();
        //让图标消失
        imgQusetion.setVisibility(View.GONE );
    }

    @Override
    public void onClick(View v) {
        if (getFragmentManager().getBackStackEntryCount()>1) {
            getFragmentManager().popBackStack();
            imgQusetion.setVisibility(View.VISIBLE);
        } else {
            finish();
        }
    }
}
